import Vue from "vue" //过滤器

//审核状态
Vue.filter("auditStatus", (val) => {
  switch (val) {
    case 0:
      return "待审核"
    case 1:
      return "已通过"
    case 2:
      return "不通过"
    default:
      return ""
  }
})

//日期格式化
Vue.filter("formatDateString", (val) => {
  if (val) {
    val = val + ""
    if (val.length > 10 && val.length < 19) {
      var date = new Date(parseInt(val))
      var YY = date.getFullYear() + "-"
      var MM =
        (date.getMonth() + 1 < 10
          ? "0" + (date.getMonth() + 1)
          : date.getMonth() + 1) + "-"
      var DD = date.getDate() < 10 ? "0" + date.getDate() : date.getDate()
      return YY + MM + DD
    } else {
      var arr1 = val.split(" ")
      return arr1[0]
    }
  }
})
